<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

<xsl:param name="groupname">alt.binaries.lsm</xsl:param>
<xsl:param name="pageindex">1</xsl:param>
<xsl:param name="item"/>
<xsl:param name="index"/>
<xsl:param name="UI_PAGE_SIZE">8</xsl:param>
<xsl:param name="PAGE_MAX">10</xsl:param>


 
<xsl:variable name="num" select="count(/list/article)"/>
	    
<xsl:variable name="min" select="1 + (floor (($pageindex - 1) div $PAGE_MAX) * $PAGE_MAX)"/>
<xsl:variable name="max" select="$min + $PAGE_MAX"/>
<xsl:variable name="hi"  select="$pageindex * $UI_PAGE_SIZE"/>
<xsl:variable name="low" select="$hi - $UI_PAGE_SIZE"/> 
<xsl:variable name="sz"  select="floor($num div $UI_PAGE_SIZE)"/> 
<xsl:variable name="chosen"  select="//article[contains(id, $item)]"/> 


<xsl:template match="/">
	
<html lang="en">
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<meta http-equiv="x-ua-compatible" content="ie=edge" />
<title>Slablet</title>
<meta name="apple-mobile-web-app-capable" content="yes" />
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" />
<link rel="stylesheet" href="/assets/stylesheets/master.css" />
        <link rel='stylesheet' href='/nntp2.css?234' type='text/css'/>
		<script language='javascript' src='/images2.js?52467'></script>
<!--[if IE 8]>
<link rel="stylesheet" href="assets/stylesheets/ie8.css" />
<![endif]-->
<!--[if !IE]><!-->
<script src="/assets/javascripts/iscroll.js"></script>
<!--<![endif]-->
<script src="/assets/javascripts/jquery.js"></script>
<script src="/assets/javascripts/master.js"></script>
</head>
<body onload="attach()">
<div id="main" class="abs">
	
	<!-- titlebar here -->
	<div class="abs header_upper chrome_light">
		<span class="float_left button" id="button_navigation">
			Navigation
		</span>
		
		<xsl:if test="string-length($index) &gt; 0">
		<a href="/ui/commandhandler/request/page/group/{$groupname}/page/{$pageindex}/response/xsl" class="float_left button">
			Back
		</a>
		</xsl:if>
		
		<a href="#" class="float_right button">
			Sign out
		</a>
		<xsl:value-of select="$groupname"/>
	</div>
	<!-- http://www2.ghost.net/ui/commandhandler/group/alt.binaries.nospam.teenfem.nonude/page/1/request/renew -->
	<!-- http://www2.ghost.net/ui/groupdialog/group/alt.binaries.nospam.teenfem.nonude/page/1/request/renew/more/7975922 -->
	<!-- toolbar here -->
	<div class="abs header_lower chrome_light">
		<a href="/ui/commandhandler/group/{$groupname}/page/1/request/renew/response/xsl" class="icon icon_refresh"></a>
		<a href="#" class="icon icon_redo"></a>
		<a href="#" class="icon icon_loopback"></a>
		<a href="#" class="icon icon_squiggle"></a>
		<a href="#" class="icon icon_shuffle"></a>
		<a href="#" class="icon icon_magnifying_glass"></a>
		<a href="#" class="icon icon_map_marker"></a>
		<a href="#" class="icon icon_chat"></a>
		<a href="#" class="icon icon_chat2"></a>
		<a href="#" class="icon icon_medical"></a>
		<a href="#" class="icon icon_clock"></a>
		<a href="#" class="icon icon_eye"></a>
		<a href="#" class="icon icon_target"></a>
		<a href="#" class="icon icon_tag"></a>
		<a href="#" class="icon icon_tags"></a>
	</div>
	
	<!-- main content here -->
	<div id="main_content" class="abs">
		<div id="main_content_inner">
			 
		<xsl:choose>
			<xsl:when test="string-length($index) &gt; 0">
				<!--
				<a href="/x/groupname/{$groupname}/pageindex/{$pageindex}"><xsl:value-of select="$groupname"/></a>
				 &#187; 
				<xsl:value-of select="$chosen/subject"/>
				-->
				<div align="center">
				<img id='box' onclick='donext(1);' src="/ui/image/group/{$groupname}/id/{$chosen/id}/thumb/large"/>
				</div>
				
				<div align="center">
				<select id='drp' onchange="location.href=this.className+this.options[this.selectedIndex].value;" class="/ui/commandhandler/request/index/index/{$index}/group/{$groupname}/page/{$pageindex}/response/xsl/item/">
					
						<optgroup label="Group 1">
							<xsl:for-each select="//article[@index=$index]/items/article">
				      	<xsl:sort select="subject"/>
						<option value="{id}">
		<xsl:if test="contains(id, $item)">
			<xsl:attribute name="selected">selected</xsl:attribute>
		</xsl:if><xsl:value-of select="subject"/></option>
					</xsl:for-each>
					</optgroup>
				</select>
				</div>
				
			</xsl:when>
			<xsl:otherwise>
				
				 
				  
				 
				  <xsl:apply-templates select="/list/article">
				  	<xsl:sort select="subject"/>
				  </xsl:apply-templates>  
				  
			</xsl:otherwise>
		</xsl:choose>
		 		
	 
			 
		</div>
	</div>
	<div class="abs footer_lower chrome_light">
		<a href="#" class="float_left button">
			Foo
		</a>
		<a href="#" class="float_left button">
			Bar
		</a>
		<a href="#" class="icon icon_bird float_right"></a>
		 <xsl:call-template name="navbar"/>
	</div>
</div>


<!-- sidebar here -->
<div id="sidebar" class="abs">
	<span id="nav_arrow"></span>
	<div class="abs header_upper chrome_light">
		App Name
	</div>
	 
	
	<div id="sidebar_content" class="abs">
		<div id="sidebar_content_inner">
			<ul id="sidebar_menu">
				<li id="sidebar_menu_home">
					<a href="#"><span class="abs"></span>Home</a>
				</li>
			 
			    <xsl:apply-templates select="//group"/>
				 
			</ul>
		</div>
	</div>
	
	
	<div class="abs footer_lower chrome_light">     
		<a href="#" class="icon icon_gear2 float_left"></a>
		<span class="float_right gutter_right">Some descriptive text here</span>
	</div>
</div>
</body>
</html>



</xsl:template>


<xsl:template name="navbar">
	
	    <xsl:if test="$pageindex &gt; 1">
	    	<a href="/ui/commandhandler/request/page/group/{$groupname}/page/{$pageindex - 1}/response/xsl">Prev</a> - 
	    </xsl:if>

	    <xsl:if test="$min &gt; $PAGE_MAX">
	    	<a href="/ui/commandhandler/request/page/group/{$groupname}/page/1/response/xsl">1</a> - 
	    	<a href="/ui/commandhandler/request/page/group/{$groupname}/page/{$min - 1}/response/xsl">...</a> 
	    </xsl:if> 
	    
	<xsl:call-template name="navbar.ex"/>
	
	    <xsl:if test="$max &lt; $sz">
	    	<a href="/ui/commandhandler/request/page/group/{$groupname}/page/{$max}/response/xsl">...</a> - 
	    	<a href="/ui/commandhandler/request/page/group/{$groupname}/page/{$sz}/response/xsl"><xsl:value-of select="$sz"/></a> - 
	    </xsl:if>  
	
	    <xsl:if test="$pageindex &lt; $sz">
	    	<a href="/ui/commandhandler/request/page/group/{$groupname}/page/{$pageindex + 1}/response/xsl">Next</a> 
	    </xsl:if> 
	    
</xsl:template>
 

<xsl:template name="navbar.ex">
	<xsl:param name="i" select="$min"/> 
	<xsl:if test="($i &lt; $max) and ($i &lt; $sz)"> 
		
		<xsl:choose>
			<xsl:when test="$i = $pageindex">
				<b><xsl:value-of select="$i"/></b>
			</xsl:when>
			<xsl:otherwise>
				<a href="/ui/commandhandler/request/page/group/{$groupname}/page/{$i}/response/xsl"><xsl:value-of select="$i"/></a>
			</xsl:otherwise>
		</xsl:choose>
		 
		 - 
		<xsl:call-template name="navbar.ex">
			<xsl:with-param name="i" select="$i + 1"/>
		</xsl:call-template>
	</xsl:if>
</xsl:template>
 

<xsl:template match="group">
	
				<li>
		<xsl:if test="$groupname=.">
			<xsl:attribute name="class">active</xsl:attribute>
		</xsl:if>
					<a href="/ui/commandhandler/request/group/response/xsl/group/{.}"><xsl:value-of select="."/></a>
				</li>
				 
</xsl:template>
 

<xsl:template match="list/article">
   <xsl:variable name="key"><xsl:choose>
			<xsl:when test="contains(id, '-')"><xsl:value-of select="substring-before(id, '-')"/></xsl:when>
			<xsl:otherwise><xsl:value-of select="id"/></xsl:otherwise>
		</xsl:choose></xsl:variable>
		
 	<xsl:if test="(position() &gt; $low) and (position() &lt; ($hi + 1))">
  <div class="frame"> 
  	<xsl:if test="type='picture'">
  	    	<a href="/ui/commandhandler/request/index/index/{@index}/item/{$key}/group/{$groupname}/page/{$pageindex}/response/xsl">
  		<img onload='preload(this,this.className)' src="/images/clear.gif" class="/ui/image/group/{$groupname}/id/{id}/thumb/ok"/>
  		</a>
  		<br/>
  	</xsl:if>
  	
  	<xsl:value-of select="count(./items/article)"/> items
  	<br/>
  <xsl:value-of select="subject"/>
  	
  </div>
   </xsl:if>
  
</xsl:template>




</xsl:stylesheet>
